import { createApp } from 'vue'
// 注册组件
import ElementPlus from 'element-plus'
// 组件的样式
import 'element-plus/dist/index.css'
import router from './route'
// 注册所有的图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 引入pinia
import { createPinia } from 'pinia'
const pinia = createPinia()

import App from './App.vue'

const app = createApp(App)

// 中文分页配置
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
app.use(ElementPlus, {
    locale: zhCn,
})
// 注册指令
import ScrollToElementDirective from '@/utils/ScrollToElementDirective.js'
app.directive('scroll-to-element', ScrollToElementDirective)

// 循环注册所有的图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
// 引入全局样式
import '@/assets/css/index.scss'
import '@/assets/css/iconfont.css'
app.use(ElementPlus).use(router).mount('#app')
app.use(pinia)
